package feng.demo.service;

import feng.demo.dao.PermDao;
import feng.demo.entity.Perm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
@CacheConfig(cacheNames = {"perm"})
public class PermServiceImpl implements PermService{
    @Autowired
    PermDao permDao;
    @Override
    @Cacheable
    public List<Perm> findAll() {
        return permDao.findAll();
    }

    @Override
    @Cacheable(key = "#p0")
    public Perm findById(Integer permid) {
        return permDao.findById(permid);
    }
}
